package com.central.modules.sys.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 超级管理员枚举
 */
@Getter
@AllArgsConstructor
public enum SuperAdminEnum {

    YES("1", "是"), NO("0", "否");

    private final String code;
    private final String name;

    //组装
    public static Map<String, Object> toType() {
        Map<String, Object> typeMap = new HashMap<String, Object>();
        typeMap.put("dictType", "superAdmin");
        typeMap.put("dictName", "是否是超级管理员");
        typeMap.put("datas", Arrays.asList(values()).stream().map(tmpEnum -> {
            Map<String, Object> dataMap = new HashMap<>();
            dataMap.put("dictLabel", tmpEnum.getName());
            dataMap.put("dictValue", tmpEnum.getCode());
            return dataMap;
        }).collect(Collectors.toList()));

        return typeMap;
    }
}